home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 37 / CD Expert nº 37.iso / LastCall / lastcall.exe / stuff / lastcall.dxr / 00094_Volume Slider Per channel.ls < prev    next >
Encoding:
Text File  |  2000-03-27  |  1.2 KB  |  52 lines

  1. property pSpr, pMinLeft, pMaxRight, pChannels
  2.  
  3. on beginSprite me
  4.   channelList = []
  5.   pChannels = string(pChannels)
  6.   repeat with X = 1 to the number of items in pChannels
  7.     add(channelList, integer(item X of pChannels))
  8.   end repeat
  9.   pChannels = channelList
  10.   pSpr = sprite(me.spriteNum)
  11.   pMinLeft = 359
  12.   pMaxRight = 450
  13.   mUpdate(me)
  14. end
  15.  
  16. on mUpdate me
  17.   pSpr.locH = pMinLeft + (the volume of sound pChannels[1] / 255.0 * (pMaxRight - pMinLeft))
  18. end
  19.  
  20. on mUpdateVolumeSlider me
  21.   global gMuteAllSounds, gMuted, gMusicChan
  22.   if gMuteAllSounds then
  23.     toggleMute(1)
  24.   end if
  25.   if pChannels[1] = gMusicChan then
  26.     gMuted = 0
  27.   end if
  28.   mUpdate(me)
  29.   playBeepSound(the volume of sound pChannels[1])
  30. end
  31.  
  32. on mouseDown me
  33.   repeat while the stillDown
  34.     pSpr.locH = min(max(pMinLeft, the mouseH), pMaxRight)
  35.     updateStage()
  36.   end repeat
  37. end
  38.  
  39. on mouseUp me
  40.   mid = pSpr.locH - pMinLeft
  41.   percent = float(mid) / (pMaxRight - pMinLeft)
  42.   newVolume = integer(255 * percent)
  43.   repeat with chan in pChannels
  44.     set the volume of sound chan to fixVolume(newVolume)
  45.   end repeat
  46.   mUpdateVolumeSlider(me)
  47. end
  48.  
  49. on getPropertyDescriptionList me
  50.   return [#pChannels: [#format: #string, #comment: "Channels?", #default: 1]]
  51. end
  52.